package com.yangye.pisystem.controller;

import com.yangye.picommon.model.PiResult;
import com.yangye.picommon.model.page.PageRequest;
import com.yangye.picommon.model.page.PageResult;
import com.yangye.pilog.domain.SysLog;
import com.yangye.pilog.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangye
 * @date 2019/10/21
 */
@RestController
@RequestMapping("/sys/logs")
public class SysLogController {

	@Autowired
	private SysLogService sysLogService;

	@GetMapping("/page")
	@PreAuthorize("hasAuthority('sys:log')")
	PiResult listPage(SysLog sysLog, PageRequest pageRequest) {
		PageResult<SysLog> page = sysLogService.findPage(sysLog, pageRequest);
		return PiResult.succeed(page);
	}
}
